package com.netease.nim.uikit.business.session.viewholder;

import android.text.TextUtils;

import com.aiyige.R;
import com.aiyige.utils.PhotoUtil;
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.netease.nimlib.sdk.msg.attachment.ImageAttachment;

/**
 * Created by zhoujianghua on 2015/8/4.
 */
public class MsgViewHolderPicture extends MsgViewHolderThumbBase {

    public MsgViewHolderPicture(BaseMultiItemFetchLoadAdapter adapter) {
        super(adapter);
    }

    @Override
    protected int getContentResId() {
        return R.layout.nim_message_item_picture;
    }

    @Override
    protected void onItemClick() {
//        WatchMessagePictureActivity.start(context, message);
        try {
            ImageAttachment imageAttachment = (ImageAttachment) message.getAttachment();
            String path = imageAttachment.getPath();
            if (TextUtils.isEmpty(path)) {
                path = imageAttachment.getUrl();
            }
            PhotoUtil.startPhotoView(path);
        } catch (Exception e) {

        }
    }

    @Override
    protected String thumbFromSourceFile(String path) {
        return path;
    }
}
